package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.ShoppingService;
import com.jt.service.UserMemberService;

import com.jt.vo.NumAndPriceVO;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserMemberController {
    @Autowired
    private UserMemberService userMemberService;
    @Autowired
    private ShoppingService shoppingService;
    @RequestMapping("/updateUser")
    public SysResult updateUser(@RequestBody User user) {
        userMemberService.updateUser(user);
        return SysResult.success();
    }

    @RequestMapping("/showNumAndPrice")
    public NumAndPriceVO showNumAndPrice(@RequestBody User user){
        return shoppingService.selectNumAndPrice(user.getId());
    }

    @RequestMapping("/fingOne")
    public SysResult fingAll(@RequestBody User user){
        return SysResult.success(userMemberService.fingAll(user));
    }
}
